home *** CD-ROM | disk | FTP | other *** search
- import java.applet.Applet;
- import java.applet.AudioClip;
- import java.awt.Color;
- import java.awt.Component;
- import java.awt.Container;
- import java.awt.LayoutManager;
- import java.awt.Panel;
- import java.awt.ScrollPane;
- import java.net.MalformedURLException;
- import java.net.URL;
- import java.net.URLEncoder;
-
- public class ScrollBoxLink extends Applet {
- private String[] url;
- private String[] text;
- private String target;
- // $FF: renamed from: wi int
- private int field_0;
- // $FF: renamed from: he int
- private int field_1;
- private Color backColor;
- public Color normalColor;
- public Color enterColor;
- public int justify;
- public int decx;
- public boolean hand;
- private int heightSpace;
- private AudioClip sound;
- public AudioClip clicSound;
- private boolean loopSound;
- public boolean animated;
- public int pause;
-
- public ScrollBoxLink() {
- this.normalColor = Color.black;
- this.enterColor = Color.black;
- this.justify = 1;
- this.decx = 0;
- this.hand = true;
- this.heightSpace = 10;
- this.animated = false;
- this.pause = 200;
- }
-
- public String getAppletInfo() {
- return "Name: ScrollBoxLink\r\nAuthor: Taiji Software";
- }
-
- public void register() {
- try {
- URL u = new URL("http://www.taijisoftware.com");
- ((Applet)this).getAppletContext().showDocument(u, "_blank");
- } catch (Exception e) {
- System.out.println(e);
- this.stop();
- }
- }
-
- public void init() {
- String codeBase = null;
-
- try {
- codeBase = (new URL(((Applet)this).getCodeBase().toString())).getHost();
- System.out.println("Copyright 1999, 2001 Taiji Software(tm)\nYour domain name is : " + codeBase);
- codeBase = codeBase.toUpperCase();
- } catch (Exception var10) {
- }
-
- if (!((Applet)this).getCodeBase().toString().toUpperCase().startsWith("FILE") || ((Applet)this).getParameter("debug") != null) {
- String regCode = ((Applet)this).getParameter("registration_code");
- if (regCode == null) {
- regCode = ((Applet)this).getParameter("reg_domain");
- if (regCode == null) {
- this.register();
- } else {
- if (regCode.length() == codeBase.length() + 4 && !codeBase.startsWith("WWW.")) {
- codeBase = "WWW." + codeBase;
- } else if (regCode.length() == codeBase.length() - 4 && codeBase.startsWith("WWW.")) {
- codeBase = codeBase.substring(4);
- }
-
- char[] chars = new char[codeBase.length()];
- codeBase.getChars(0, codeBase.length(), chars, 0);
- String key = new String("haricot");
- char[] chars2 = new char[key.length()];
- key.getChars(0, key.length(), chars2, 0);
-
- for(int i = 0; i < codeBase.length(); ++i) {
- int j;
- if (i >= key.length()) {
- j = i - key.length() * (i / key.length());
- } else {
- j = i;
- }
-
- chars[i] += chars2[j];
- chars[i] = (char)(chars[i] - chars[i] / 26 * 26 + 97);
- }
-
- String res = new String(chars);
- if (!res.equalsIgnoreCase(regCode)) {
- this.register();
- }
- }
- } else if (!regCode.equals("settevercsedegnamiaj") && !regCode.equals("8078")) {
- this.register();
- }
- }
-
- this.getParameters();
-
- int n;
- for(n = 0; ((Applet)this).getParameter("text" + Integer.toString(n + 1)) != null; ++n) {
- }
-
- ((Container)this).setLayout((LayoutManager)null);
- ScrollPane sp = new ScrollPane(0);
- ((Component)sp).setBounds(0, 0, this.field_0, this.field_1);
- if (((Applet)this).getParameter("background_color") != null) {
- ((Component)sp).setBackground(this.getColor("background_color"));
- }
-
- Panel p = new Panel();
- ((Container)p).setLayout((LayoutManager)null);
- ((Container)sp).add(p);
- ((Container)this).add(sp);
- Link l = new Link("essai de link component", this, "loading", "loading");
- ((Container)p).add(l);
- int Lheight = ((Component)l).getPreferredSize().height;
- ((Container)p).remove(l);
- ((Component)p).setSize(sp.getViewportSize().width - sp.getVScrollbarWidth(), n * Lheight + (n - 1) * this.heightSpace);
-
- for(int i = 0; i < n; ++i) {
- Link ll = new Link(((Applet)this).getParameter("text" + Integer.toString(i + 1)), this, ((Applet)this).getParameter("link" + Integer.toString(i + 1)), ((Applet)this).getParameter("status_bar_text" + Integer.toString(i + 1)));
- ((Container)p).add(ll);
- ((Component)ll).setBounds(this.decx, i * (Lheight + this.heightSpace), sp.getViewportSize().width - sp.getVScrollbarWidth() - this.decx, Lheight);
- }
-
- if (this.sound != null) {
- if (this.loopSound) {
- this.sound.loop();
- return;
- }
-
- this.sound.play();
- }
-
- }
-
- public void stop() {
- if (this.sound != null) {
- this.sound.stop();
- }
-
- }
-
- public void getParameters() {
- this.field_0 = ((Component)this).getSize().width;
- this.field_1 = ((Component)this).getSize().height;
- String s = ((Applet)this).getParameter("justify");
- if (s != null) {
- this.justify = Integer.parseInt(s);
- }
-
- s = ((Applet)this).getParameter("pause");
- if (s != null) {
- this.pause = Integer.parseInt(s);
- }
-
- s = ((Applet)this).getParameter("width_offset");
- if (s != null) {
- this.decx = Integer.parseInt(s);
- }
-
- s = ((Applet)this).getParameter("height_space");
- if (s != null) {
- this.heightSpace = Integer.parseInt(s);
- }
-
- s = ((Applet)this).getParameter("hand");
- if (s != null && s.equals("0")) {
- this.hand = false;
- }
-
- s = ((Applet)this).getParameter("animated");
- if (s != null && s.equals("1")) {
- this.animated = true;
- }
-
- if (((Applet)this).getParameter("normal_color") != null) {
- this.normalColor = this.getColor("normal_color");
- }
-
- if (((Applet)this).getParameter("enter_color") != null) {
- this.enterColor = this.getColor("enter_color");
- }
-
- s = ((Applet)this).getParameter("sound_name");
- if (s != null) {
- this.sound = ((Applet)this).getAudioClip(((Applet)this).getCodeBase(), s);
- }
-
- s = ((Applet)this).getParameter("loop_sound");
- if (s != null) {
- if (s.equals("yes")) {
- this.loopSound = true;
- } else {
- this.loopSound = false;
- }
- }
-
- s = ((Applet)this).getParameter("clic_sound_name");
- if (s != null) {
- this.clicSound = ((Applet)this).getAudioClip(((Applet)this).getCodeBase(), s);
- }
-
- }
-
- private Color getColor(String param) {
- String s = ((Applet)this).getParameter(param);
- if (s != null) {
- if (s.substring(0, 1).equals("#")) {
- s = s.substring(1);
- int i = Integer.parseInt(s, 16);
- return new Color(i);
- } else {
- return null;
- }
- } else {
- return null;
- }
- }
-
- public URL giveURL(String url) {
- try {
- if (url.toUpperCase().startsWith("HTTP")) {
- return new URL(url);
- } else if (url.toUpperCase().startsWith("FTP")) {
- int p = url.indexOf(":");
- int p2 = url.indexOf(":", p + 1);
- if (p2 != -1) {
- url = url.substring(0, p + 3) + URLEncoder.encode(url.substring(p + 3, url.length()));
- }
-
- p = url.indexOf("%40");
- if (p != -1) {
- url = url.substring(0, p) + "@" + url.substring(p + 3, url.length());
- }
-
- return new URL(url);
- } else {
- return new URL(((Applet)this).getCodeBase(), url);
- }
- } catch (MalformedURLException e) {
- System.out.println(e);
- return null;
- }
- }
- }
-